﻿using CheccCoverplateCulvertAssemble.Common.DataBaseInterface;
using CheccCoverplateCulvertAssemble.Common.Http;
using CheccCulvertHelpers;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;

namespace CheccCoverplateCulvertAssemble.Common
{
    internal class HttpRequestData
    {
        private static HttpRequestData _httpRequestData = null;
        private readonly string httpIp = null;
        private HttpRequestData()
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Config.xml");
            httpIp = xmlDocument.GetElementsByTagName("Ip")[0].InnerText;
        }

        /// <summary>
        /// 创建http请求实例
        /// </summary>
        /// <returns></returns>
        public static HttpRequestData CreateHttpRequestData()
        {
            if (_httpRequestData == null)
                _httpRequestData = new HttpRequestData();
            return _httpRequestData;
        }

        /// <summary>
        /// POST请求与获取结果 
        /// </summary>
        /// <param name="Url">http地址</param>
        /// <param name="postDataStr">post请求参数</param>
        /// <returns>返回json字符串</returns>
        private string HttpPost(string Url, string postDataStr)
        {
            try
            {
                // http://
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + httpIp + "/WZW/" + Url);
                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = postDataStr.Length;
                StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII);
                writer.Write(postDataStr);
                writer.Flush();
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                string encoding = response.ContentEncoding;
                if (encoding == null || encoding.Length < 1)
                {
                    encoding = "UTF-8"; //默认编码
                }
                StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
                string jsonData = reader.ReadToEnd();
                //返回的加密数据进行解密返回
                return jsonData;
            }
            catch (Exception ex)
            {
                //System.Windows.Forms.MessageBox.Show(ex.Message);
                MessageBox.Show("服务器连接异常!");
                return "";
            }
        }

        /// <summary>
        /// POST请求与获取结果 
        /// </summary>
        /// <param name="Url">http地址</param>
        /// <param name="postDataStr">post请求参数</param>
        /// <returns>返回json字符串</returns>
        private string HttpPostHXT(string Url, string postDataStr)
        {
            try
            {
                // http://
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + httpIp + "/HXT/" + Url);
                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = postDataStr.Length;
                StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII);
                writer.Write(postDataStr);
                writer.Flush();
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                string encoding = response.ContentEncoding;
                if (encoding == null || encoding.Length < 1)
                {
                    encoding = "UTF-8"; //默认编码
                }
                StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
                string jsonData = reader.ReadToEnd();
                //返回的加密数据进行解密返回
                return jsonData;
            }
            catch (Exception ex)
            {
                //System.Windows.Forms.MessageBox.Show(ex.Message);
                MessageBox.Show("服务器连接异常!");
                return "";
            }
        }

        /// <summary>
        /// POST请求与获取结果 
        /// </summary>
        /// <param name="Url">http地址</param>
        /// <param name="postDataStr">post请求参数</param>
        /// <returns>返回json字符串</returns>
        private string HttpPostLXH(string Url, string postDataStr)
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + httpIp + "/LXH/" + Url);
                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = postDataStr.Length;
                StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII);
                writer.Write(postDataStr);
                writer.Flush();
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                string encoding = response.ContentEncoding;
                if (encoding == null || encoding.Length < 1)
                {
                    encoding = "UTF-8"; //默认编码
                }
                StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
                string jsonData = reader.ReadToEnd();
                //返回的加密数据进行解密返回
                return jsonData;
            }
            catch (Exception ex)
            {
                //System.Windows.Forms.MessageBox.Show(ex.Message);
                MessageBox.Show("服务器连接异常!");
                return "";
            }
        }

        #region 具体接口功能

        /// <summary>
        /// 根据通用图查询组装左侧锥坡坡比
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlopeRatio> SelectAssembleLeftConeSlopeRatio(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleLeftConeSlopeRatio", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装左侧锥坡坡比数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlopeRatio>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图获取组装沉降缝参数
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<SettlementJointParameter> GetAssembleSettlementJointWraps()
        {
            string postData = $"";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostLXH("selectAssembleSettlementJointWraps", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("获取组装沉降缝参数数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<SettlementJointParameter>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询组装右侧锥坡坡比
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlopeRatio> SelectAssembleRightConeSlopeRatio(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleRightConeSlopeRatio", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装右侧锥坡坡比数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlopeRatio>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询组装左侧锥坡基础深度
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlopeBaseDepth> SelectAssemblebaseDepthLeftConicalSlope(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssemblebaseDepthLeftConicalSlope", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装左侧锥坡基础深度数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlopeBaseDepth>>(info.data.ToString());
        }

        /// <summary>
        /// 根据通用图查询右侧锥坡基础深度
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlopeBaseDepth> SelectAssemblebaseDepthRightConicalSlope(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssemblebaseDepthRightConicalSlope", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装右侧锥坡基础深度数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlopeBaseDepth>>(info.data.ToString());
        }

        /// <summary>
        /// 根据标准图查询支撑梁1号钢筋
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<SupportbeamNo1Rebar> SelectAssembleBracebeamNo1s(string standardDrawing) 
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleBracebeamNo1s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询支撑梁1号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<SupportbeamNo1Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询支撑梁2号钢筋
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<SupportbeamNo2Rebar> SelectAssembleBracebeamNo2s(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleBracebeamNo2s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询支撑梁2号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<SupportbeamNo2Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询支撑梁尺寸
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<SupportbeamDimension> SelectAssembleSupportBeamDimension(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleSupportBeamDimension", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询支撑梁尺寸数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<SupportbeamDimension>>(info.data.ToString());
        }
        /// <summary>
        /// 获取保护层厚度信息
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<ProtectiveThickness> SelectAssembleProtectiveThickness()
        {
            string postData = "";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleProtectiveThickness", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("获取保护层厚度信息数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ProtectiveThickness>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询整体式1号钢筋
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<MonolithicNo1Rebar> SelectAssembleMonolithicNo1s(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleMonolithicNo1s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询整体式1号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<MonolithicNo1Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询整体式2号钢筋
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<MonolithicNo2Rebar> SelectAssembleMonolithicNo2s(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleMonolithicNo2s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询整体式2号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<MonolithicNo2Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询整体式2'号钢筋信息
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<MonolithicNo2pRebar> SelectAssembleMonolithicNo2p(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleMonolithicNo2p", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询整体式2'号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<MonolithicNo2pRebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询整体式3号钢筋信息
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<MonolithicNo3Rebar> SelectAssembleMonolithicNo3s(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleMonolithicNo3s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询整体式3号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<MonolithicNo3Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询整体式4号钢筋信息
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<MonolithicNo4Rebar> SelectAssembleMonolithicNo4s(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleMonolithicNo4s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询整体式4号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<MonolithicNo4Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询整体式5号钢筋信息
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<MonolithicNo5Rebar> SelectAssembleMonolithicNo5s(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleMonolithicNo5s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询整体式5号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<MonolithicNo5Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询整体式6号钢筋信息
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<MonolithicNo6Rebar> SelectAssembleMonolithicNo6s(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleMonolithicNo6s", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询整体式6号钢筋数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<MonolithicNo6Rebar>>(info.data.ToString());
        }
        /// <summary>
        /// 获取分离式结构尺寸参数
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<SeparateStructureSizeParameter> SelectAssembleSeparateStructureParameters()
        {
            string postData = "";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleSeparateStructureParameters", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("获取分离式结构尺寸参数数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<SeparateStructureSizeParameter>>(info.data.ToString());
        }
        /// <summary>
        /// 获取整体式结构尺寸参数
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<IntegralStructureSizeParameter> SelectAssembleIntegralStructureDimensionParameter()
        {
            string postData = "";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleIntegralStructureDimensionParameter", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("获取整体式结构尺寸参数数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<IntegralStructureSizeParameter>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询左八字墙基本参数
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<Aliform> selectAssembleLeftShapedWall(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleLeftShapedWall", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询左八字墙基本参数数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<Aliform>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询右八字墙基本参数
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<Aliform> SelectAssembleRightShapedWall(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleRightShapedWall", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询右八字墙基本参数数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<Aliform>>(info.data.ToString());
        }
        /// <summary>
        /// 根据标准图查询八字墙基本参数-可变
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<AliformBaseBurialDepth> SelectAssembleShapedWallParameters(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleShapedWallParameters", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询八字墙基本参数-可变数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<AliformBaseBurialDepth>>(info.data.ToString());
        }
        /// <summary>
        /// 获取八字墙承载力
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<AliformBearingCapacity> SelectAssembleBearingCapacitySlabWalls()
        {
            string postData = "";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleBearingCapacitySlabWalls", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("获取八字墙承载力数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<AliformBearingCapacity>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询左帽石
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<CapStone> SelectAssembleLeftCapStone(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleLeftCapStone", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询左帽石数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<CapStone>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询右帽石
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<CapStone> SelectAssembleRightCapStone(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleRightCapStones", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询右帽石数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<CapStone>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询左端墙
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<EndWall> SelectAssembleLeftEndWalls(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleLeftEndWalls", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询左端墙数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<EndWall>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询右端墙
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<EndWall> SelectAssembleRightEndWalls(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleRightEndWalls", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询右端墙数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<EndWall>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询端墙检索项
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<EndWallSearchEntry> SelectAssembleEndWallSearch(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleEndWallSearch", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询端墙检索项数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<EndWallSearchEntry>>(info.data.ToString());
        }
        /// <summary>
        /// 查询街头材料数量
        /// </summary>
        /// <param name="standardDrawing"></param>
        /// <returns></returns>
        public List<JointMaterial> SelectAssembleQuantityStreetMaterials(string standardDrawing)
        {
            standardDrawing = DES3.EnCBC(standardDrawing);
            string postData = $"standardDrawing={standardDrawing}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPost("selectAssembleQuantityStreetMaterials", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询街头材料数量数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<JointMaterial>>(info.data.ToString());
        }
        /// <summary>
        /// 根据通用图查询组装八字墙基础埋深
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<AliformBaseBurialDepth> SelectWallFoundationBuriedDepth(string generalDiagram)
        {
            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectWallFoundationBuriedDepth", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装八字墙基础埋深数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<AliformBaseBurialDepth>>(info.data.ToString());
        }

        /// <summary>
        /// 根据通用图查询组装八字墙承载力
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<AliformBearingCapacity> SelectAssembleBearingCapacity(string generalDiagram)
        {
            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleBearingCapacity", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装八字墙承载力数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<AliformBearingCapacity>>(info.data.ToString());
        }

        /// <summary>
        /// 根据通用图查询组装左侧八字墙
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<Aliform> SelectAssembleLeftEightFigureWall(string generalDiagram)
        {
            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleLeftEightFigureWall", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装左侧八字墙数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<Aliform>>(info.data.ToString());
        }

        /// <summary>
        /// 根据通用图查询组装右侧八字墙
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<Aliform> SelectAssembleRightEightFigureWall(string generalDiagram)
        {
            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleRightEightFigureWall", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装右侧八字墙数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<Aliform>>(info.data.ToString());
        }

        /// <summary>
        /// 获取组装八字墙偏角信息
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<AliformAngleOfAvertence> GetAssembleSplayedWallAngles()
        {
            string postData = $"";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostLXH("selectAssembleSplayedWallAngles", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装八字墙偏角数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<AliformAngleOfAvertence>>(info.data.ToString());
        }

        /// <summary>
        /// 获取组装八字墙距洞口内侧襟边
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns>图集,襟边</returns>
        public List<AliformEntranceCaveInEdge> SelectAssembleShapedWallHole()
        {
            string postData = $"";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleShapedWallHole", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装八字墙距洞口内侧襟边数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<AliformEntranceCaveInEdge>>(info.data.ToString());
        }

        /// <summary>
        /// 根据通用图查询组装左侧锥坡
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlope> SelectAssembleLeftConicalSlope(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleLeftConicalSlope", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装右侧锥坡数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlope>>(info.data.ToString());
        }


        /// <summary>
        /// 根据通用图查询组装右侧锥坡
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlope> SelectAssembleRightConicalSlope(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleRightConicalSlope", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装右侧锥坡数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlope>>(info.data.ToString());
        }

        /// <summary>
        /// 根据通用图查询组装左侧锥坡襟边
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlopeEdge> SelectAssembleLeftSideTaperedEdge(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleLeftSideTaperedEdge", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装左侧锥坡襟边数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlopeEdge>>(info.data.ToString());
        }

        /// <summary>
        /// 根据通用图查询组装左侧锥坡襟边
        /// </summary>
        /// <param name="generalDiagram">通用图</param>
        /// <returns></returns>
        public List<ConicalSlopeEdge> SelectAssembleRightSideTaperedEdge(string generalDiagram)
        {

            generalDiagram = DES3.EnCBC(generalDiagram);
            string postData = $"generalDiagram={generalDiagram}";
            var info = JsonConvert.DeserializeObject<Info>(HttpPostHXT("selectAssembleRightSideTaperedEdge", postData));
            if (null == info) return null;
            if (!Convert.ToBoolean(info.state)) { System.Windows.Forms.MessageBox.Show("查询组装左侧锥坡襟边数据失败!"); return null; }
            return JsonConvert.DeserializeObject<List<ConicalSlopeEdge>>(info.data.ToString());
        }

        #endregion
    }
}
